package string;
/*
boolean matches(String regex):匹配
 */
public class MatchesDemo {
    public static void main(String[] args) {
        //[a-zA-Z0-9_]+@[a-zA-Z0-9]+(\.(a-zA-Z)+)+
        String email="2224958084@qq.comffv";
        String regex="[a-zA-Z0-9_]+@[a-zA-Z0-9]+(\\.(a-zA-Z)+)+";
        boolean math=email.matches(regex);
        if (math){
            System.out.println("正确");
        }else {
            System.out.println("错误");
        }
    }
}
